<template>
  <div>
    <div class="container">
      <el-card class="box-card basic-card">
        <div class="title">component LkSearch:</div>
        <LkSearch :search-map="searchMap" ref="contentForm" :searchOptions="searchOptions"/>
      </el-card>
    </div>
    <br />
    <div class="container">
      <el-card class="box-card basic-card">
        <div class="title">component LkTable:</div>
        <LkTable />
      </el-card>
    </div>

    <!-- <div @click="methods.goPage">go page</div> -->
    <!-- <component :is="component" transition="fade" transition-mode="out-in" /> -->
    <!-- <highlightjs language="javascript" :code="vueCode" /> -->
    <!-- <example /> -->
  </div>
</template>

<script setup>
// import LkSearch from '@/components/LkSearch/index.vue'

// import {DictTag, FileUpload, LkSearch, LkTable, Hamburger, IconSelect, iFrame, ImagePreview, ImageUpload, Pagination, ParentView, RightToolbar, Screenfull, TreeSelect} from "infinitus-components"; // 本地组件
import {LkSearch, LkTable} from 'infinitus-components' // npm包的组件
// import {IconSelect} from '../../../components_dist/index.js' // npm包的组件
// import { LkSearch, LkTable } from "../../components_dist/index.js"; // npm包的组件

// import {LkSearch, IconSelect, FileUpload} from './infinitus-components-manager.esm.js' // 本地调用组件
// import LkSearch from '@/components_source/LkSearch/index.vue'
// import LkTable from '@/components_source/LkTable/index.vue'
// import example from "@/md/example.md";
// import { getVueCode, importComponent } from "@/common";
import dayjs from "dayjs";


const searchMap = ref([
  {
    key: "orderNo",
    label: "订单编号",
    type: "input",
    placeholder: "请输入"
  },
  {
    key: "orderStatus",
    label: "订单状态",
    type: "select",
    options: [
      { label: "正常", value: "00" },
      { label: "冻结", value: "01" },
      { label: "删除", value: "99" }
    ],
    placeholder: "请选择"
  },
  {
    key: "trigger",
    label: "是否已触发发货",
    type: "select",
    options: [
      { label: "未触发", value: "N" },
      { label: "已触发", value: "Y" }
    ],
    placeholder: "请选择"
  },
  {
    key: "dealerNoOrMobile",
    label: "会员卡号/手机号",
    type: "input",
    placeholder: "请输入"
  },
  {
    key: "expressNo",
    label: "快递单号",
    type: "input",
    placeholder: "请输入"
  },
  {
    key: "queryDateType",
    type: "select",
    options: [
      { label: "下单时间", value: "PO_DATE" },
      { label: "发货时间", value: "DELIVERY_DATE" },
      { label: "收货时间", value: "RECEIVE_DATE" }
    ]
  },
  {
    key: "time",
    type: "datetimerange",
    format: "YYYY-MM-DD HH:mm:ss", // 格式化
    pickerOptions: time => {
      return time.getTime() > Date.now() - 8.64e6;
    },
    placeholder: {
      start: "",
      end: ""
    }
  }
]);
const searchOptions = ref({
  orderNo: null, //订单编号
  trigger: null, //是否已触发发货
  orderStatus: null, //订单状态
  dealerNoOrMobile: null, // 会员卡号/手机号
  expressNo: null, // 快递单号
  time: [
    `${dayjs()
      .subtract(30, "day")
      .format("YYYY-MM-DD")} 23:59:59`,
    `${dayjs(`${new Date()}`).format("YYYY-MM-DD")} 23:59:59`
  ], //入参时间
  queryDateType: "PO_DATE" //入参时间分类
});
const router = useRouter();
const route = useRoute();
const component = ref("");
const vueCode = ref("");
const options = ref([
  { value: 222, label: "a", elTagType: "default" },
  { value: 222, label: "b", elTagType: "default" },
  { value: 222, label: "c", elTagType: "default" },
  { value: 222, label: "d", elTagType: "default" },
  { value: 222, label: "f", elTagType: "xx" }
]);
const values = ref([222]);

// console.log('components', IconFont)

const componentName = route.name;
// component.value = importComponent(componentName)

// 首次进入调用列表接口
onMounted(() => {
  // router.addRoute({
  //   name: "admin",
  //   path: "/admin",
  //   component: () => import("@/views/gift/newGift/index.vue"),
  //   meta: { title: "admin", icon: "dashboard", affix: true }
  // });
  // console.log(router.getRoutes())
  // router.addRoute('admin', { path: 'settings', component: AdminSettings })
  // getVueCode(componentName).then(res => {
  //   vueCode.value = res;
  // });
});
const methods = {
  goPage() {
    router.push({ path: "/admin" });
  }
};
</script>

<style lang="scss" scoped>
.container {
  background: #cccccc;
  padding: 15px;
}
.title {
  margin-bottom: 15px;
}
</style>
